package br.com.merks.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@NamedQueries({
	@NamedQuery(name="market.findAll",query="SELECT x FROM br.com.merks.model.Market x WHERE x.published = 1"),
	@NamedQuery(name="market.findTopMarkets",query="SELECT x FROM br.com.merks.model.Market x WHERE x.published = 1"),
	@NamedQuery(name="market.findLastMarkets",query="SELECT x FROM br.com.merks.model.Market x WHERE x.published = 1")
	
	})
public class Market {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	private String title;
	private String description;
	
	@Enumerated(EnumType.STRING)  
	private MarketType type;

	private Integer published;
	
	@Temporal(TemporalType.DATE)
	private Date initialDate;
	@Temporal(TemporalType.DATE)
	private Date endDate;
		
	private Long categoryId;
	private String categoryName;
	
	@Enumerated(EnumType.STRING)  
	private StatusType status;
	
	private String tags;
	
	public StatusType getStatus() {
		return status;
	}
	public void setStatus(StatusType status) {
		this.status = status;
	}
	public String getCategoryName() {
		return categoryName;
	}
	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	//getters and setters
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public void setType(MarketType type) {
		this.type = type;
	}
	public MarketType getType() {
		return type;
	}
	public void setPublished(Integer published) {
		this.published = published;
	}
	public Integer getPublished() {
		return published;
	}
	public Date getInitialDate() {
		return initialDate;
	}
	public void setInitialDate(Date initialDate) {
		this.initialDate = initialDate;
	}  
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}
	public Long getCategoryId() {
		return categoryId;
	}
	public void setTags(String tags) {
		this.tags = tags;
	}
	public String getTags() {
		return tags;
	}
}